using System.Collections.Generic;

namespace IQIGame.Onigao.GamePlay
{
    public abstract class DynParamProcessBase
    {
        public abstract EntityDynamicParamType paramType { get; }

        public LevelPlayRegionController regionCtrl { get; }

        public DynParamProcessBase(LevelPlayRegionController regionCtrl)
        {
            this.regionCtrl = regionCtrl;
        }


        /// <summary>
        /// 触发区域忽略高度
        /// </summary>
        public virtual bool ignoreTriggerHeight => false;

        /// <summary>
        /// 是否有触发区域
        /// </summary>
        public virtual bool isContainTriggerRect => false;

        /// <summary>
        /// 实体添加时,处理动态参数
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="currentParam"></param>
        /// <param name="paramMap"></param>
        public virtual void OnEntityAddProcess(LevelPlayBaseEntity entity, BaseEntityDynamicParam currentParam, in IReadOnlyDictionary<EntityDynamicParamType, BaseEntityDynamicParam> paramMap)
        {
            if (isContainTriggerRect)
            {
                if (paramMap.TryGetValue(EntityDynamicParamType.TriggerRect, out var triggerRectParam) && triggerRectParam is EntityParamTriggerRect rect)
                {
                    regionCtrl.entityCtrl.AddEntityTriggerRange(entity, rect);
                }
            }
        }

        public virtual void OnOneParamEffectiveAdded(BaseEntityDynamicParam paramValue, LevelPlayBaseEntity entity)
        {

        }

        public virtual void OnOneParamEffectiveRemoved(BaseEntityDynamicParam paramValue, LevelPlayBaseEntity entity)
        {

        }

        public virtual void OnListParamEffectiveChanged(EntityDynamicParamType paramType, IReadOnlyList<BaseEntityDynamicParam> paramValueList, IReadOnlyList<LevelPlayBaseEntity> entityList)
        {

        }
    }

}